package com.leng.common.exception;


import com.leng.common.constant.ServiceExceptionEnum;
import com.leng.common.core.ApiStatusCode;

public class ServiceExceptionWithoutLog extends RuntimeException {

    private Integer code;

    public ServiceExceptionWithoutLog(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public ServiceExceptionWithoutLog(ServiceExceptionEnum enum1) {
        super(enum1.getName());
        this.code = enum1.getCode();
    }
    public ServiceExceptionWithoutLog(ApiStatusCode enum1) {
        super(enum1.getMsg());
        this.code = enum1.getCode();
    }

    public ServiceExceptionWithoutLog(ApiStatusCode enum1, Object... exceptionMsgFormat) {
        super(String.format(enum1.getMsg(),exceptionMsgFormat));
        this.code = enum1.getCode();
    }

    public ServiceExceptionWithoutLog(ServiceExceptionEnum enum1, Object... exceptionMsgFormat) {
        super(enum1.getName().contains("%s")? String.format(enum1.getName(),exceptionMsgFormat):enum1.getName());
        this.code = enum1.getCode();
    }
    


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

}
